package main;

import java.util.HashMap;

import solver.MatrixSolver;
import solver.OctaveSolver;

public class Esercizio4 {
	
	public static void main(String[] args) {
		
		String pathCsv = "C:\\Users\\fede1587\\eclipseworkspace\\Simulazione\\CSV\\matrix5.csv";
		HashMap<String,Double> variables = new HashMap<String,Double>();
		
		System.out.println();
		System.out.println();
		System.out.println("M/M/1/N");
		
		double mu = ((double) 1) / 4;
		double lambda1 = ((double) 3) / 5;
		double lambda2 = ((double) 2) / 5;
		double lambda3 = ((double) 1) / 5;
		System.out.println("#################################################################################");
		System.out.println("  ----  Z = 5  ----   S = 4  -----  N = 4  ----  ");
		variables.put("lambda1",lambda1);
		variables.put("lambda2",lambda2);
		variables.put("lambda3",lambda3);
		variables.put("-lambda1",-lambda1);
		variables.put("-lambda2-mu",-(lambda2 + mu));
		variables.put("-lambda3-mu",-(lambda3 + mu));
		variables.put("mu",mu);
		variables.put("-mu",-mu);
		MatrixSolver.solve_csv_mm1n(pathCsv,mu,variables);
		System.out.println("#################################################################################");
		
		System.out.println();
		System.out.println();
		System.out.println("M/Iper/1/N/FIFO");
				
		pathCsv = "C:\\Users\\fede1587\\eclipseworkspace\\Simulazione\\CSV\\matrix6.csv";
		
		double alfa1 = 0.98;
		double alfa2 = 0.02;
		double mu1 = 1.0;
		double mu2 = ((double) 1) / 151;
		System.out.println("#################################################################################");
		System.out.println("  ----  Z = 5  ----   N = 4  -----  S1 = 1.0  ----  S2 = 151 ---- alfa1 = 0.98 ---- alfa2 = 0.02 ---- ");
		
		variables.put("lambda2",lambda2);
		variables.put("lambda3",lambda3);		
		variables.put("-lambda1",-lambda1);
		variables.put("mu1",mu1);
		variables.put("mu2",mu2);
		variables.put("lambda1*alfa1",lambda1*alfa1);
		variables.put("lambda1*alfa2",lambda1*alfa2);
		variables.put("-lambda2-mu1",-(lambda2 + mu1));
		variables.put("-lambda2-mu2",-(lambda2 + mu2));
		variables.put("mu1*alfa1",mu1*alfa1);
		variables.put("mu2*alfa1",mu2*alfa1);
		variables.put("mu1*alfa2",mu1*alfa2);
		variables.put("mu2*alfa2",mu2*alfa2);
		variables.put("-mu1-lambda3",-(lambda3 + mu1));
		variables.put("-mu2-lambda3",-(lambda3 + mu2));
		variables.put("-mu1",-mu1);
		variables.put("-mu2",-mu2);
		
		MatrixSolver.solve_csv_mIper1n(pathCsv,mu1,mu2,variables);
		System.out.println("#################################################################################");
		
		System.out.println();
		System.out.println();
		System.out.println("M/Iper/1/N/LIFO");
				
		pathCsv = "C:\\Users\\fede1587\\eclipseworkspace\\Simulazione\\CSV\\matrix7.csv";
		
		System.out.println("#################################################################################");
		System.out.println("  ----  Z = 5  ----   N = 4  -----  S1 = 1.0  ----  S2 = 151 ---- alfa1 = 0.98 ---- alfa2 = 0.02 ---- ");
			
		variables.put("-lambda1",-lambda1);
		variables.put("mu1",mu1);
		variables.put("mu2",mu2);
		variables.put("lambda1*alfa1",lambda1*alfa1);
		variables.put("lambda1*alfa2",lambda1*alfa2);
		variables.put("lambda2*alfa1",lambda2*alfa1);
		variables.put("lambda2*alfa2",lambda2*alfa2);
		variables.put("lambda3*alfa1",lambda3*alfa1);
		variables.put("lambda3*alfa2",lambda3*alfa2);
		variables.put("-lambda2-mu1",-(lambda2 + mu1));
		variables.put("-lambda2-mu2",-(lambda2 + mu2));
		variables.put("-mu1-lambda3",-(lambda3 + mu1));
		variables.put("-mu2-lambda3",-(lambda3 + mu2));
		variables.put("-mu1",-mu1);
		variables.put("-mu2",-mu2);
		
		MatrixSolver.solve_csv_mIper1nLifo(pathCsv,mu1,mu2,variables);
		System.out.println("#################################################################################");
		
		
		
	}

}
